//
//  ESJokesNetResult.m
//  EasyStyle
//
//  Created by FK on 16/5/9.
//  Copyright © 2016年 FK. All rights reserved.
//

#import "ESJokesNetResult.h"


@implementation ESJokesNetResult

// 解析业务数据
- (void)parseNetResult:(NSDictionary *)jsonDictionary
{
    [super parseNetResult:jsonDictionary];
    
    if ([self.errorCode intValue] != 0) {
        return;
    }
    
    NSDictionary *dataDict = jsonDictionary[@"result"];
    
    _jokesList = dataDict[@"data"];

}

- (NSMutableArray *)getLastedJokesData:(NSArray *)detailData
{
    
    NSArray *colorHexArr = @[@"c6e2ff",@"ffb6c1",@"66cdaa",@"cbffc0",@"c0cbff",@"fdcb12",@"f4ca17",@"f8b195",@"f0f8ff"];
    
    NSMutableArray *resultList = [NSMutableArray array];
    
    for (NSDictionary *dict in detailData) {
        int colorIndex = arc4random() % colorHexArr.count;
        
        LastedjokesItem *jokeItem = [LastedjokesItem new];
        jokeItem.content = dict[@"content"];
        jokeItem.hashId = dict[@"hashId"];
        jokeItem.unixtime = dict[@"unixtime"];
        jokeItem.updatetime = dict[@"updatetime"];
        jokeItem.colorHex = [colorHexArr objectAtIndex:colorIndex];
        [resultList addObject:jokeItem];
    }
    
    return resultList;
}

@end

@implementation LastedjokesItem

@end
